using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Lesson23T : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        Ray r=new Ray(this.transform.position,transform.forward);
        RaycastHit HitResult;
        Physics.Raycast(r, out HitResult, 1000, 1 << LayerMask.NameToLayer("Monster"));
        if(HitResult.collider != null)
        {
            //HitResult.distance
            print("11111"+HitResult.collider.gameObject.name);
        }
        RaycastHit[] hitInfo;
        hitInfo = Physics.RaycastAll(r, 1000, 1 << LayerMask.NameToLayer("Monster"));
        for (int i = 0; i < hitInfo.Length; i++)
        {
            print("222222"+hitInfo[i].collider.gameObject.name);
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
